CDEBUG = -g
CFLAGS = $(CDEBUG) -Wall -pedantic -ansi --std=c99 -pipe

srcdir = .
prefix = /usr/local
includedir = $(prefix)
libdir = $(prefix)

.PHONY : all lib mostlyclean clean install

#force make to favor the static libs over dynamic ones
#.LIBPATTERNS = lib%.a lib%.so

all : lib 

libcoordMath.a(ECEFtoLLH.o) : ECEFtoLLH.c coordMath.h
libcoordMath.a(ECEFtoNED.o) : ECEFtoNED.c coordMath.h
libcoordMath.a(LLHtoECEF.o) : LLHtoECEF.c coordMath.h
libcoordMath.a(NEDtoECEF.o) : NEDtoECEF.c coordMath.h
libcoordMath.a(deltaECEF.o) : deltaECEF.c coordMath.h
libcoordMath.a(deltaLLH.o)  : deltaLLH.c  coordMath.h

lib : libcoordMath.a
libcoordMath.a : libcoordMath.a(ECEFtoLLH.o ECEFtoNED.o LLHtoECEF.o NEDtoECEF.o deltaECEF.o deltaLLH.o)
	ranlib libcoordMath.a

unit_test : unit_test.c -lcoordMath -lm

install : all
	cp coordMath.h $(includedir)/include
	cp libcoordMath.a $(libdir)/lib

clean : 
	rm *.o

mostlyclean : clean
	rm libcoordMath.a
